package com.example.chandao.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ItemType {

    INPUT("input", "单行输入"),

    TEXT("textarea", "多行输入"),

    RADIO("radio", "单选"),

    CHECKBOX("checkbox", "多选"),

    SELECT("select", "下拉单选"),

    MULTI("multi", "下拉多选"),

    NUMBER("number", "数字输入"),

    DATE("date", "日期"),

    TIME("time", "时间"),

    SCORING("scoring", "评价题"),

    FILE("file", "文件上传"),

    PHONE("tel", "手机号"),

    EMAIL("email", "邮箱"),

    CARD("id", "身份证"),

    SIGN("sign", "签名"),

    HTML("rich", "富文本"),

    MAP("map", "位置元素"),

    SLIDER("slider", "滑动条"),

    TABLE_AUTO("autoincrement", "自增表"),

    TABLE("table", "静态表"),

    TITLE("title", "标题"),

    PAGE("page", "分页符"),

    MT_KEY("mkey", "美图KEY测量"),

    IMG_EVA("imgeva", "图片评价"),

    ;

    private final String code;

    private final String name;


    /**
     * 是否普通文本类型
     */
    public static Boolean isText(String type) {
        return type.equals(INPUT.getCode()) || type.equals(TEXT.getCode()) || type.equals(NUMBER.getCode())
                || type.equals(PHONE.getCode()) || type.equals(EMAIL.getCode()) || type.equals(CARD.getCode())
                || type.equals(DATE.getCode()) || type.equals(TIME.getCode()) || type.equals(SLIDER.getCode());
    }


    /**
     * 是否字典选择类型
     */
    public static Boolean isDict(String type) {
        return type.equals(RADIO.getCode()) || type.equals(CHECKBOX.getCode()) || type.equals(SELECT.getCode())
                || type.equals(MULTI.getCode()) || type.equals(SCORING.getCode());
    }


    /**
     * 是否文件上传类型
     */
    public static Boolean isFile(String type) {
        return type.equals(FILE.getCode()) || type.equals(IMG_EVA.getCode());
    }


    /**
     * 是否表格类型
     */
    public static Boolean isTable(String type) {
        return type.equals(TABLE_AUTO.getCode()) || type.equals(TABLE.getCode());
    }


}
